package lablayer.view.additional.toolpanelstates;

import javafx.scene.Node;
import javafx.scene.layout.Panel;
import javafx.scene.control.ListView;
import javafx.scene.control.ScrollView;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.input.MouseEvent;
import lablayer.view.ViewDummy;
import lablayer.view.stat.ViewBoxBuffer;
import lablayer.view.ViewMiddleValue;
import lablayer.view.ViewMedian;
import lablayer.view.ViewSampleVariance;
import lablayer.view.ViewStandardAMSError;
import lablayer.view.ViewStandardDeviation;
import lablayer.view.ViewVariationCoefficient;
import lablayer.view.ViewLeftBorder;
import lablayer.view.ViewRightBorder;
import lablayer.view.ViewAccuracyAssessment;
import lablayer.view.ViewBox;
import lablayer.view.ViewDifferenceBetween;
import lablayer.view.ViewDotStudent;
import lablayer.view.ViewPartitionIntervals;
import lablayer.view.ViewStatisticalCharacteristics;
import lablayer.view.ViewMinValue;
import lablayer.view.ViewMaxValue;
import lablayer.view.ViewIntervalLength;
import lablayer.view.ViewIntervalBorders;
import lablayer.view.ViewEmpiricalFrequency;
import lablayer.view.ViewTheoreticalFrequency;

/**
 * @author Darkness
 */

public class ViewToolComponent extends ViewTool {
    init {
        this.id = ViewTool.ComponentId;
    }

    override public function create(): Node {
        Panel {			
            content: [
                HBox {					
                    content: [
                        Rectangle {
                            width: 75							
                            fill: Color.TRANSPARENT
                        },
                        Label {
                            text: "Компоненты:"
                        },
                        Rectangle {
                            width: 5						
                            fill: Color.TRANSPARENT
                        },
                        VBox {							
                            content: [
                                Rectangle {
                                    // change width to set width of ScrollView below
									width: 450
                                    height: 1
                                    fill: Color.TRANSPARENT
                                },
                                ScrollView {									
									fitToHeight: true
									fitToWidth: true
                                    node: ListView {
                                        items: [
                                            Label {
                                                text: "Данные"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewDummy = ViewDummy {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
                                            Label {
                                                text: "Критическая точка распределения Стьюдента"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewDotStudent = ViewDotStudent {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
                                            Label {
                                                text: "Среднее значение"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewMiddleValue = ViewMiddleValue {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }

                                            },
                                            Label {
                                                text: "Медиана"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewMedian = ViewMedian {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
                                            Label {
                                                text: "Выборочная дисперсия"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewSampleVariance = ViewSampleVariance {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
                                            Label {
                                                text: "Стандартная ошибка среднего арифметического выборки"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewStandardAMSError = ViewStandardAMSError {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
                                            Label {
                                                text: "Среднее квадратичное отклонение"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewStandardDeviation = ViewStandardDeviation {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
                                            Label {
                                                text: "Коэффициент вариации"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewVariationCoefficient = ViewVariationCoefficient {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
                                            Label {
                                                text: "Левая граница доверительного интервала"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewLeftBorder = ViewLeftBorder {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
                                            Label {
                                                text: "Правая граница доверительного интервала"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewRightBorder = ViewRightBorder {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
                                            Label {
                                                text: "Точность оценки"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewAccuracyAssessment = ViewAccuracyAssessment {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
                                            Label {
                                                text: "Различие между средними значениями выборок"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewDifferenceBetween = ViewDifferenceBetween {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
											Label {
                                                text: "Число интервалов разбиения"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewPartitionIntervals = ViewPartitionIntervals {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
											Label {
                                                text: "Статистические характеристики"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewStatisticalCharacteristics = ViewStatisticalCharacteristics {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
											Label {
                                                text: "Минимальное значение выборки"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewMinValue = ViewMinValue {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
											Label {
                                                text: "Максимальное значение выборки"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewMaxValue = ViewMaxValue {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
											Label {
                                                text: "Длина интервала разбиения"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewIntervalLength = ViewIntervalLength {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
											Label {
                                                text: "Границы интервалов разбиения"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewIntervalBorders = ViewIntervalBorders {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
											Label {
                                                text: "Эмпирическая частота"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewEmpiricalFrequency = ViewEmpiricalFrequency {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
											Label {
                                                text: "Теоретическая частота"
                                                onMouseClicked: function(e: MouseEvent): Void {
                                                    var viewBox: ViewBox = ViewBoxBuffer.getViewBox();
                                                    var com: ViewTheoreticalFrequency = ViewTheoreticalFrequency {
                                                        translateX: viewBox.getViewComponentCoordinates().x
                                                        translateY: viewBox.getViewComponentCoordinates().y
                                                    };
                                                    viewBox.addViewComponent(com);
                                                }
                                            },
                                        ]
                                    }
                                }
                            ]
                        } //end VBox
                    ]
                }//end HBox

            ]
        }
    }

}